import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: () => import('@/views/login/index.vue') },
  {
    path: '/home',
    redirect: '/main',
    component: () => import('@/views/home/index.vue'),
    children: [
      {
        path: '/main',
        name: 'main',
        component: () => import('@/components/main.vue')
      },
      // 订单路由
      { path: '/order-list', name: 'orderList', component: () => import('@/views/home/order/orderList.vue') },
      { path: '/goodslist', name: 'goodsList', component: () => import('@/views/home/store/goods.vue') },
      { path: '/order-sta', name: 'orderSta', component: () => import('@/views/home/order/orderSta.vue') },
      // 素材路由
      { path: '/material', component: () => import('@/views/home/material/material.vue') },
      { path: '/review', component: () => import('@/views/home/material/review.vue') },
      { path: '/usermaterial', component: () => import('@/views/home/material/usermaterial.vue') },
      // 优惠券路由
      { path: '/general-couppon', name: 'GeneralCoupon', component: () => import('@/views/home/coupon/GeneralCoupon.vue') },
      { path: '/shop-couppon', name: 'ShopCoupon', component: () => import('@/views/home/coupon/ShopCoupon.vue') },
      { path: '/add-coupon', name: 'AddCoupon', component: () => import('@/views/home/coupon/AddCoupon.vue') },
      { path: '/edit-coupon', name: 'EditCoupon', component: () => import('@/views/home/coupon/EditCoupon.vue') },
      // 系統設置路由
      { path: '/parameter', name: 'Parameter', component: () => import('@/views/home/set/parameter/index.vue') },
      // 账号管理路由
      { path: '/setAccount', name: 'setAccount', component: () => import('@/views/home/set/set_account') },
      // 推廣列表
      {
        path: '/extension-list',
        name: 'ExtensionList',
        component: () => import('@/views/home/extension/extension-list.vue')
      },
      // 推广详情页面
      { path: '/extension', name: 'extension', component: () => import('@/views/home/extension/extend/index.vue') },
      // 提现管理
      { path: '/cash-management', name: 'cashManagement', component: () => import('@/views/home/financing/cash-management.vue') },
      { path: '/spending-details', name: 'spendingDetails', component: () => import('@/views/home/financing/spending-details.vue') },
      { path: '/income-details', name: 'incomeDetails', component: () => import('@/views/home/financing/income-details.vue') },
      // 商圈管理路由
      { path: '/share', component: () => import('@/views/trading_area/share') },
      { path: '/person', component: () => import('@/views/trading_area/person') },
      // 店铺管理
      { path: '/storelist', name: 'storeList', component: () => import('@/views/home/store/stores.vue') },
      { path: '/goodslist', name: 'goodsList', component: () => import('@/views/home/store/goods.vue') },
      {
        path: '/store-edit/:storeid',
        name: 'storeEdit',
        component: () => import('@/views/home/store/store-edit.vue'),
        props: true
      },
      // { path: '/goodslist', name: 'goodsList', component: () => import('@/views/home/store/goods.vue') },
      { path: '/storerights', name: 'storerights', component: () => import('@/views/home/store/storerights.vue') },
      { path: '/storeaudit', name: 'storeaudit', component: () => import('@/views/home/store/storeaudit.vue') },
      { path: '/industry', name: 'Industry', component: () => import('@/views/home/store/industry.vue') },
      // 账号管理路由
      { path: '/setAccount', name: 'setAccount', component: () => import('@/views/home/set/set_account') },
      // 推广详情页面
      { path: '/extension', name: 'extension', component: () => import('@/views/home/extension/extend/index.vue') },
      { path: '/goodscate', name: 'goodsCate', component: () => import('@/views/home/store/good-type.vue') },
      { path: '/goodchildtype/:cateId', name: 'goodchildtype', component: () => import('@/views/home/store/good-childtype.vue'), props: true },
      {
        path: '/examine/:id',
        name: 'examine',
        component: () => import('@/views/examine.vue'),
        props: true
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
